package com.sftz.modules.minapp.resourceRecord.module;

import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;

import com.sftz.modules.minapp.resourceRecord.dto.PersonCourseScoreDto;
import com.sftz.modules.minapp.resourceRecord.service.CourseResourceStudyViewService;
import com.sftz.modules.minapp.user.cache.RedissionUserCache;

/**
 * @author   DuKL 学习记录
 * @Date	 2018年12月21日
 */
@IocBean
@At("/wx/resourceRecord")
public class PersonStudyReportModule {

	@Inject
	private CourseResourceStudyViewService courseResourceStudyViewService;

	/**
	* 开大项目
	* @author   DuKL
	* @Date	 2018年8月31日
	* (effect:学习记录)
	*/

	@At
	@Ok("json")
	public Object queryCourseResocurse(@Param("courseId") final Integer courseId, @Param("token") final String token) {
		Integer userId = RedissionUserCache.getUserId(token);
		return courseResourceStudyViewService.personCourseMessage(courseId, userId);
	}

	@At
	@Ok("json")
	public PersonCourseScoreDto studentStudyScore(@Param("courseId") final Integer courseId,
			@Param("token") final String token) {
		Integer userId = RedissionUserCache.getUserId(token);
		return courseResourceStudyViewService.studentStudyScore(courseId, userId);
	}
}